11
A hybrid intelligent system to improve predictive accuracy for cache prefetching Sohail Sarwar a,, Zia Ul-Qayyum b,2 , Owais Ahmed Malik a,1 a School of Electrical Engineering and Computer Sciences, National University of Science and Technology, Sector H-12, P.O. Box 44000, Islamabad, Pakistan b University Institute of Information Technology, University of Arid Agriculture, P.O. Box 44000, Rawalpindi, Pakistan article info Keywords: Cache prefetching Case based reasoning Neural networks Markovian model Rule based systems Suffix tree abstract Cache being the fastest medium in memory hierarchy has a vital role to play for fully exploiting available resources, concealing latencies in IO operations, languishing the impact of these latencies and hence in improving system response time. Despite plenty of efforts made, caches alone cannot comprehend larger storage requirements without prefetching. Cache prefetching is speculatively fetching data to restrain all delays. However, effective prefetching requires a strong prediction mechanism to load relevant data with higher degree of accuracy. In order to ameliorate the predictive performance of cache prefetching, we applied the hybrid of two AI approaches named case based reasoning (CBR) and artificial neural networks (ANN). CBR maintains the past experience and ANN are used in adaptation phase of CBR instead of employing static rule base. The novelty of technique in this domain is valued due to hybrid of two approaches as well as usage of suffix tree in populating the CBR’s case base. Suffix trees provide rich data patterns for populating case base and greatly enhanced the overall performance. A number of evaluations from different aspects with varying parameters are presented (along with some findings) where the effi- cacy of our technique is affirmed with improved predictive accuracy and reduced level of associated costs. Ó 2011 Elsevier Ltd. All rights reserved. 1. Introduction With emergence of IT, information systems have proven their imperative usefulness in almost every aspect of human life. This fact can be ascertained by stipulation of information systems in variety of applications ranging from economic forecasting to seis- mic analysis, from drug discovery to analyzing inordinate amounts of data (in medical sciences), from non-trivial mathematical prob- lem solving (such as fractals) to genome analysis and many more; these examples are asserted here as a result of invigorating innova- tive approaches in this realm of IT. Barring the embodied areas of application, we cannot overlook the research challenges to solve and to meet the requirement of these applications. For instance, disparity between ‘execution speed of processors’ and ‘performance of peripherals’ (e.g. hard disk drive – HDDs), delays involved in the form of seek time, rotational delay and block transfer time (in taking data from HDD to RAM and then to the processor) are a major concern. These delays are ob- served while reading data from and writing to the disks (aka input output or IO operation). The mentioned latencies are intensified once we move down the storage hierarchy (as shown in Fig. 1 (Linda & Julia, 2003)), which introduce significant data latency for CPUs, and results in wastage of processing resources i.e. it is under utili- zation (15% of its capacity is utilized (Takahashi, Ahmad, & Mori, 2008)). This paper focuses on reducing data latency for CPU through prefetching. Several efforts have been made for curbing the impact of IO latencies by improving IO performance of these peripherals. This improvement is courtesy to some available ‘‘cache prefetch- ing’’ techniques with their respective pros and cons (Papathana- siou & Scott, 2005). Cache prefetching is speculatively fetching data that will be accessed in the future to prevent wastage of CPU cycles, searching from slow secondary storage media, match their speed gaps, avoid page miss and hide IO latencies (Baer & Chen, 1991). So the ultimate purpose of prefetching would be to avoid the conditions of page fault where demanded page is to be accessed from secondary storage devices and processor waits until data is fetched in main memory. During prefetching, there may be a situation in which cache is full and newly prefetched pages require some space to be created for them. So eviction of old pages from memory is required. A great care has to be taken in carrying out this process of page replace- ment; because cache performance might be affected greatly once useful pages are ejected. If this situation of replacing the useful pages carries on, we may face a memory bottleneck known as memory pressure (Papathanasiou & Scott, 2005; leading to insuffi- cient space for system processes). 0957-4174/$ - see front matter Ó 2011 Elsevier Ltd. All rights reserved. doi:10.1016/j.eswa.2011.06.054 Corresponding author. Tel.: +92 51 9085 2400; fax: +92 51 8317363. E-mail addresses: [email protected], [email protected] (S. Sarwar), [email protected] (Z. Ul-Qayyum), [email protected] (O.A. Malik). 1 Tel.: +92 51 9085 2400; fax: +92 51 8317363. 2 Tel.: +92 51 9290154; fax: +92 51 9290113. Expert Systems with Applications 39 (2012) 1626–1636 Contents lists available at ScienceDirect Expert Systems with Applications journal homepage: www.elsevier.com/locate/eswa

A hybrid intelligent system to improve predictive accuracy for cache prefetching

Embed Size (px)

Citation preview

Page 1: A hybrid intelligent system to improve predictive accuracy for cache prefetching

Expert Systems with Applications 39 (2012) 1626–1636

Contents lists available at ScienceDirect

Expert Systems with Applications

journal homepage: www.elsevier .com/locate /eswa

A hybrid intelligent system to improve predictive accuracy for cache prefetching

Sohail Sarwar a,⇑, Zia Ul-Qayyum b,2, Owais Ahmed Malik a,1

a School of Electrical Engineering and Computer Sciences, National University of Science and Technology, Sector H-12, P.O. Box 44000, Islamabad, Pakistanb University Institute of Information Technology, University of Arid Agriculture, P.O. Box 44000, Rawalpindi, Pakistan

a r t i c l e i n f o

Keywords:Cache prefetchingCase based reasoningNeural networksMarkovian modelRule based systemsSuffix tree

0957-4174/$ - see front matter � 2011 Elsevier Ltd. Adoi:10.1016/j.eswa.2011.06.054

⇑ Corresponding author. Tel.: +92 51 9085 2400; faE-mail addresses: [email protected], s

Sarwar), [email protected] (Z. Ul-Qayyum), owMalik).

1 Tel.: +92 51 9085 2400; fax: +92 51 8317363.2 Tel.: +92 51 9290154; fax: +92 51 9290113.

a b s t r a c t

Cache being the fastest medium in memory hierarchy has a vital role to play for fully exploiting availableresources, concealing latencies in IO operations, languishing the impact of these latencies and hence inimproving system response time. Despite plenty of efforts made, caches alone cannot comprehend largerstorage requirements without prefetching. Cache prefetching is speculatively fetching data to restrain alldelays. However, effective prefetching requires a strong prediction mechanism to load relevant data withhigher degree of accuracy. In order to ameliorate the predictive performance of cache prefetching, weapplied the hybrid of two AI approaches named case based reasoning (CBR) and artificial neural networks(ANN). CBR maintains the past experience and ANN are used in adaptation phase of CBR instead ofemploying static rule base. The novelty of technique in this domain is valued due to hybrid of twoapproaches as well as usage of suffix tree in populating the CBR’s case base. Suffix trees provide rich datapatterns for populating case base and greatly enhanced the overall performance. A number of evaluationsfrom different aspects with varying parameters are presented (along with some findings) where the effi-cacy of our technique is affirmed with improved predictive accuracy and reduced level of associatedcosts.

� 2011 Elsevier Ltd. All rights reserved.

1. Introduction once we move down the storage hierarchy (as shown in Fig. 1 (Linda

With emergence of IT, information systems have proven theirimperative usefulness in almost every aspect of human life. Thisfact can be ascertained by stipulation of information systems invariety of applications ranging from economic forecasting to seis-mic analysis, from drug discovery to analyzing inordinate amountsof data (in medical sciences), from non-trivial mathematical prob-lem solving (such as fractals) to genome analysis and many more;these examples are asserted here as a result of invigorating innova-tive approaches in this realm of IT.

Barring the embodied areas of application, we cannot overlookthe research challenges to solve and to meet the requirement ofthese applications. For instance, disparity between ‘executionspeed of processors’ and ‘performance of peripherals’ (e.g. hard diskdrive – HDDs), delays involved in the form of seek time, rotationaldelay and block transfer time (in taking data from HDD to RAM andthen to the processor) are a major concern. These delays are ob-served while reading data from and writing to the disks (aka inputoutput or IO operation). The mentioned latencies are intensified

ll rights reserved.

x: +92 51 [email protected] ([email protected] (O.A.

& Julia, 2003)), which introduce significant data latency for CPUs,and results in wastage of processing resources i.e. it is under utili-zation (15% of its capacity is utilized (Takahashi, Ahmad, & Mori,2008)).

This paper focuses on reducing data latency for CPU throughprefetching. Several efforts have been made for curbing the impactof IO latencies by improving IO performance of these peripherals.This improvement is courtesy to some available ‘‘cache prefetch-ing’’ techniques with their respective pros and cons (Papathana-siou & Scott, 2005). Cache prefetching is speculatively fetchingdata that will be accessed in the future to prevent wastage ofCPU cycles, searching from slow secondary storage media, matchtheir speed gaps, avoid page miss and hide IO latencies (Baer &Chen, 1991). So the ultimate purpose of prefetching would be toavoid the conditions of page fault where demanded page is to beaccessed from secondary storage devices and processor waits untildata is fetched in main memory.

During prefetching, there may be a situation in which cache isfull and newly prefetched pages require some space to be createdfor them. So eviction of old pages from memory is required. A greatcare has to be taken in carrying out this process of page replace-ment; because cache performance might be affected greatly onceuseful pages are ejected. If this situation of replacing the usefulpages carries on, we may face a memory bottleneck known asmemory pressure (Papathanasiou & Scott, 2005; leading to insuffi-cient space for system processes).

Page 2: A hybrid intelligent system to improve predictive accuracy for cache prefetching

Fig. 1. Latencies in memory hierarchy: this figure illustrates latency and spacecomparison in memory hierarchy.

S. Sarwar et al. / Expert Systems with Applications 39 (2012) 1626–1636 1627

As prefetching is process of predicting the future requests andgreatly relies on strong prediction mechanism which not only pre-dicts the relevant data with higher degree of accuracy but benefitsfrom past experiences of data usage patterns; eventuating in im-proved cache hits. In order to achieve these objectives, a predictiveprefetching solution based on integration of case based reasoning(CBR) and artificial neural networks (ANN) is proposed in thispaper.

CBR is a problem solving paradigm utilizing the specific knowl-edge of past experiences preserved in case base memory (Aamodt& Plaza, 1994; Sankar, Simon, & Shiu, 2004) shown in Fig. 2. CBR

Fig. 2. The CBR cycle [16]: case based reasoning cycle showing retrieval phasethrough the adaptation phase.

extracts relevant knowledge to suggest a solution for current prob-lem. The proposed solution is evaluated based on some similaritymetric (termed as retrieval). On retrieving a similar problem fromprevious cases, respective solution is applied (termed as reuse)after its similarity assessment. Otherwise we adapt to reach theprobable solution (termed as revision or adaptation). The knowl-edge base containing the solutions is updated with retention ofsolution to new problem (termed as retain).

ANN represents a mathematical computation model consistingof an interconnected group of artificial neurons ANN is an adaptivesystem that changes its structure based on external or internalinformation that flows through the network during the learningphase. This learning or training phase can further be segregatedinto supervised learning (problem with respective solution areused to find and learn the patterns) or unsupervised learning (onlyproblem without solution are given to find and learn the patterns).We have used the multilayer perceptron (MLP) neural networkmodel which is based on supervised mode of learning. A typicalMLP–ANN will have three layers named input layer, hidden layerand output layer. The problem is fed to input layer, hidden layerperforms learning and extraction of patterns and output layer pre-sents the outcome of computation performed at hidden layer. Atypical ANN-model is given in Fig. 3.

CBR has two important aspects of ‘‘retrieval and adaptation’’preceded by case base population. This paper employs suffix treesfor populating CBR’s case base. This dataset from case base is usedas training and testing set for ANN. Suffix trees ensure presence ofmeaningful patterns in dataset for CBR and ANN. As discussedabove, the adaptation phase has a key role to play in our approachwhere ANN will predict the page most likely to be requested in ab-sence of any useful clue by CBR. Most of the CBR systems use rulesbased approach for adaptation (Smith & Thakar, 1997), but ANNbased adaptation has been employed in our system instead ofrules-driven adaptation due to following reasons (Yain & Babka,1998):

– Dependent and independent attributes cannot be defined byuser.

Fig. 3. An MLP neural network model.

Page 3: A hybrid intelligent system to improve predictive accuracy for cache prefetching

1628 S. Sarwar et al. / Expert Systems with Applications 39 (2012) 1626–1636

– Even if attributes are defined, non-linear relation (as in ourcase) cannot be defined as IF then else.

– User must understand adaptation process and sequence.– In order to devise the rule based system, complete knowledge of

underlying data is required to devise the assertions.– More intricate process when multiple case bases are used.– User must maintain rule base to be consistent with incremental

growth of case base.

In this paper resolution to some of the above issues is proposed.Different datasets (Integer strings) of different sizes have beenused for carrying out different experiments. Our case base ema-nated from the strings of integers where each integer referred toa hex address. The hex addresses were manipulated via a custom-ized data structure called suffix tree (Ukkonen, 1992). The reasonfor this step was inclusion of some natural patterns playing a vitalrole in improvising overall predictive performance of system.These datasets were furnished in the CBR’s case base in form ofcases each of length ‘n’. On the basis of first ‘n � 1’ elements ‘nth’element is predicted (as a candidate to be prefetched). The organi-zation of paper is given in the following:

Section 2 discusses methods employed for cache prefetchingand gives a hint of issues in those techniques. Section 3 lays thetheoretical foundation of work and practical implementation de-tails. The results and discussion on experiments and comparisonof proposed technique with an existing one is presented in Sections4 and 5, respectively. Section 6 concludes the work and elucidatesintended future direction.

2. Material and methods

There are several methods in which majority of work relatedto caching and specifically to cache prefetching is based upon‘‘locality of reference principle’’ (Baer & Chen, 1991) which inturn comprises of two parameters named ‘temporal locality’and ‘spatial locality’. First heuristic is based on the assumptionthat pages which have been referenced now are likely to be re-referenced in near future, so they must be retained in the mem-ory. The later is based on probability of demanding the pageswhich lie in a sequence next to currently accessed pages; sopages residing next in the sequence are fetched in advance to ex-ploit prefetching. Besides the foundation for prefetching laid bythese principles, there are few concerns as well. The first heuris-tic (temporal locality) remains unanswered for pages residing insequence or we can say it does not appreciate the second princi-ple when there is some sequential data available that can be pre-fetched. Also it requires the pages to be kept in main memorylong enough so that they can be re-referenced for a cache hit.Whereas spatial locality is only suitable for the data that is in se-quence and does not specify anything when comes the point toprefetch random pages and it means both the models are situa-tion specific and have limited applicability in prefetching. Fur-thermore, several hardware (Baer & Chen, 1991; Jouppi, 1990;Mehrotra & Harrison, 1995) and software (Chen, Mahlke &Hwu,1998; Mowry, Lam, & Gupta, 1992; Sarwar, Rasool, Meh-mood, Ahmed, & Takahashi, 2008) prefetching methods havebeen proposed. However majority of stated methods focus oncompiler-inserted prefetching of pointer targets or can be as-serted as hardware dependent and application specific. Anothertechnique for prefetching has been specified in the form ofstream buffers (Ali, Krishna, & Sweany, 2007; Jouppi, 1989). Incase of a miss, the missed block and its successive blocks are pre-fetched in stream buffer. But the success of approach dependsupon spatial locality. This is the downside of approach for com-pletely relying on sequential data whose absence would lead to

cache pollution eventuating in memory pressure (Papathanasiou& Scott, 2005). In Cherng, Dick, and Ladner (2007), a hardwarebased prefetching is used to monitor the data access patternsfor data prefetching in L2 cache. Data prefetched could stay256 bytes ahead of current data location. This approach has beenimplemented in Pentium-IV (Hinton et al., 2004). Regularrequirement for data access patterns, startup penalties beforehardware could start its work and unnecessary prefetches ini-tially are main issues in these techniques.

Markov prediction algorithm (Batiels, Karlin, & Levy, 1999) hasalso been a strong candidate for its implementation in cachingtechniques. The last part of reference stream is compared with pre-fixes of previous reference streams. The remaining patterns areprefetched in memory, so the success of algorithm depends uponpatterns in data stream. In addition to this dependency, Markovalgorithm does not adapt itself to the situation for decision makingfor future references.

The ANNs have been employed due to their predictive, adaptive,and self-organizing behavior (Chtorou, Chtru, & Hammami, 2009;Varadan & Vaishnav, 2005). But the only downside is their com-pute intensive nature impeding specifically during training whichcan be reduced with appropriate preprocessing of data presentedfor training. At the same time we have a clue of better performanceof CBR compared to ANN due to their smoother processes and col-lection of prior experiences (Arditi & Tokdemir, 1999). This papermainly focuses to improve overall performance for predictive pre-fetching with hybrid of these two machine learning techniques.The detail of reducing training effort and usage of ANN for caseadaptation of CBR cases is elaborated in Section 3.

3. Theory/calculation

System architecture of proposed approach from a theoreticalperspective is presented in Fig. 4. It has four main modules namely:preprocessor, case retrieval, case reuse and case adaptation.

Dataset Preprocessing module is concerned with populating theCBR’s case base (or system’s case base). The core issue for buildingCBR model is to devise some technique for populating the caserepository of CBR. Instead of populating the case-base randomly,in our system this activity is carried out using suffix tries (Ukko-nen, 1992) where each random sized address string in Hex formatis read over a constant temporal scale (reading each string for fewmicro-seconds). These Hex strings are converted to equivalent dec-imal for plotting address nodes on Suffix Trees. Each node in suffixtree contains three parts: data part, frequency-counter and a flag.Data part of node contains actual address; frequency-counter re-fers to how many times that data occurred in a branch of suffix de-rived from address strings and flag is used to distinguishintermediary nodes from leaf nodes. Later on, these branches basedon their occurrence frequency (repetitiveness) are extracted andplaced in the CBR’s case base. Each of the branches extracted willrefer to one case in CBR. At the end of this module, the case basegets populated with number of cases.

Case Retrieval module provides query specific solution for newaddress string (query case). The algorithm in this module com-putes level of similarity of query case vs. cases in the case base.This similarity is computed using ‘Tversky Ratio model (Chernget al., 2007)’ as a similarity metric. If computed level of similarityis 100%, that is ‘n � 1’ elements of query case and case in casebase are same then the respective solution of case in case basewill be selected and applied (Reused). Conversely, the selectedcase which is similar to queried case within a threshold (rangebetween 60% and 90%) is subjected to the Case Adaptation. If thereare more than one similar cases retrieved within mentionedrange then the decision of adaptation (or Revision) is made on

Page 4: A hybrid intelligent system to improve predictive accuracy for cache prefetching

Fig. 4. Architecture of proposed system: this diagram shows different phases of proposed system.

Fig. 5. A typical node of suffix tree: a string is plotted on the suffix tree to have afrequently occurring branch.

S. Sarwar et al. / Expert Systems with Applications 39 (2012) 1626–1636 1629

the basis of ‘Rank’ assigned to each of the retrieved cases depict-ing the level of similarity between query case and the ones re-trieved from case base.

Case reuse and revision (adaptation) module: case revision oradaptation provides us nearest and most probable solution thatwe can use if exact match of our problem case is not found.The adaptation has been carried out with three variations i.e.using ‘majority class voting (MCV)’, ‘neural networks’ and‘CBR + ANN’, respectively (details are in following section). InMCV, occurrences of certain solution are considered among re-trieved cases; the one with highest number of occurrences is se-lected and applied as solution. In this situation occurrences of the‘n’th elements will be considered for selecting the most probablecandidate to which we adapt. It is interesting to note that a sim-ilar but more sophisticated method exist in cultural algorithmswhere vote-inherit-permit (VIP) protocol is used to interconnectthe population space and belief space (Reynolds, Michalewicz &Cavaretta,1995). This kind of method is more suitable for domainwith rich set of features. The second case is of applying the neuralnetworks for adaptation where training of ANN model was car-ried out on given set of cases (cases in case base) and adaptationaccuracy was measured by applying the model on retrieved caseslacking an exact match. The point to remember is that training ofthis ANN model is done on the whole dataset available in theform of cases in case base. Third scenario again involves ANNfor the adaptation. But this time training of ANN is performedonly on retrieved cases instead of whole dataset to adapt the gi-ven case. The reason was to try out the effectiveness of neuralnetworks model by training it on more similar situations thatare specific to problem case. Here Reuse has been discussed tomake this paper self-contained; though results of this componentare not part of this work.

The implementation elaboration of all these aspects of architec-ture is given in the following subsections.

3.1. Data preprocessing

The purpose of this task is to devise a technique for populatingthe case repository of CBR by exploiting the suffix trees. We havecustomized this data structure for our problem where randomHex strings (with equivalent decimal) are used for plotting addressnodes on suffix trees. Each node in the suffix tree contains threeparts: data part, frequency-counter and a flag (Hinton et al.,2004). Data part of node contains actual address; frequency-coun-ter refers to how many times that data occurred in a branch of suf-fices derived from address strings and flag is used to distinguishintermediary nodes from leaf nodes. The representation of a nodeis given in Fig. 5.

The ‘Address Reader’ reads the Hex addresses from repository forfew micro-seconds. Each of the chunks of addresses read is hurledto ‘Suffix Tree Builder’ which will draw the suffix tree as given inFigs. 7 and 8. While drawing the tree, occurrence frequency of eachof the nodes is tracked. This will help in deciding which patternswith certain frequency will be considered for placement in CBR’scase base.

Page 5: A hybrid intelligent system to improve predictive accuracy for cache prefetching

1630 S. Sarwar et al. / Expert Systems with Applications 39 (2012) 1626–1636

This process of collecting the suffices and building the tree isillustrated below where Fig. 7 shows how to plot the string (alongwith its suffices):

String

Fig. 6. Suffix trees based data preprocesso

356982

Suffix 1

56982 Suffix 2 6982 Suffix 3 982 Suffix 4 82 Suffix 5 2

Initially the frequency-count (FC = 0) for each of the data part iszero because none of the data part in any suffix is repeated yet(Fig. 6).

What happens when certain data elements appear more thanonce; is shown in Fig. 7:

String

569249

Suffix 1

69249 Suffix 2 9249 Suffix 3 249 Suffix 4 49 Suffix 5 9

As we draw the second set of suffices, the occurrences of datapart in certain nodes are repeated hence their frequency is incre-mented. We keep on plotting the random sized strings and get suf-fix tree with data and respective frequencies.

Once operation of ‘‘Suffix Tree Builder’’ completes, the next stepis extraction of the repetitive patterns (i.e. branches of tree plotted)on the basis of their length and occurrence frequency; this extrac-tion was done using Depth First Search (DFS). We extracted all thebranches of length 9 with varying frequency depending upon num-ber of cases yielded during branch extraction. Each of thesebranches of length n = 9 was used to represent a case of CBR’s case

r: how different st

base. According to our heuristic ‘n � 1’ elements would refer to theproblem attributes and nth element is considered as respectivesolution. In other words, a combination of first eight addresses re-fers to prediction of 9th address. This situation can better be appre-hended from Fig. 9.

We extract all the branches of length nine with occurrence fre-quency of four (In order to get most frequent patterns this fre-quency can be increased as well).

3.2. Case retrieval of CBR

After populating CBR’s case base, the next step is to devise amechanism to retrieve the similar problem cases with correspond-ing solution attributes for new problem case (termed as querycase). The problem case is represented in the form of an address se-quence of length eight. In order to perform ‘‘case retrieval’’, simi-larity metrics (Finnie & Sunt, 2002) are required. There arenumber of similarity mechanisms exist in the literature to findthe similarity between a new situation and a case in the case-base(Cunningham, 2009). We tried two similarity metrics such asEuclidean distance and fuzzy logic based metrics. Euclidean dis-tance can provide the difference between corresponding attributesof query case and cases in case base, but cannot depict the degreeof similarity or dissimilarity among those cases. Fuzzy logic re-quires the weighted features in order to cluster the available casesof dataset, so that one can find out cluster containing the solutionrequired. But we neither had features nor the correspondingweights. Another option was using the ‘‘Edit distance or Levnasth-anian metric’’. This metric computes the cost of transforming querycase into case of CBR’s case base. This transformation can be donethrough addition, deletion and substitution operations whichwould not take into account the sequence of addresses so thiswas not applicable in current situation where maintain the occur-rence sequences is a key requirement.

This is the task that we could perform in an easy way usingtechnique named ‘‘Taversky’s Ratio Model’’ for retrieval of similarproblem and solution:

rings are read, translated and plotted on a tree builder.

Page 6: A hybrid intelligent system to improve predictive accuracy for cache prefetching

Fig. 7. Suffix tree (first time FC = 0): string plotted for first time with no count updated.

Fig. 8. Suffix tree (first time FC > = 0): string plotted for first time with incremented count updated.

Fig. 9. A typical case in CBR case base: representation of a case in case base comprising of 9 fields.

S. Sarwar et al. / Expert Systems with Applications 39 (2012) 1626–1636 1631

Page 7: A hybrid intelligent system to improve predictive accuracy for cache prefetching

Fig. 10. A model of case adaptation through neural networks: what phases we needto go through to find a solution if there is no similar case found.

1632 S. Sarwar et al. / Expert Systems with Applications 39 (2012) 1626–1636

SMpq ¼ # of matched Addressed cases for Query Case# of matches in CBþ# of differences in CB

:

Once similarity is computed against each problem case in thecase base, next step is to assign a ‘‘rank’’ to each of the retrievedcases for depicting degree to which retrieved cases are similar tothe query case. The cases with given rank are selected from the re-trieved ones.

While computing the similarity, it would be an ideal case if weget a problem case with 100% exact match. With exact match, thecase can be reused without any further change. Conversely, weneed to adapt the given problem using some adaptation technique.After adaptation, we will use the respective solution and retainwhole set of attributes for future usage. The performance andparameters of ANN for comparison of CBR and ANN will be dis-cussed in detail in later section.

The pseudo-code of computing the level of similarity andassignment of similarity rank is described in the following:

For i = 0 ? length of array from CaseBase{Integer lower := arraryOfQueryCase[i];Integer higher := arraryOfQueryCase [i];if (arrOfCaseBase[i] = = lower && arrOfCaseBase [i] = = higher)

common := common + 1;else

different := different + 1;}

double denominator := common + different;rank := (common/denominator)⁄100;if(rank > = 60)call method insertRetrievedCase(arrCB, rank);

3.2.1. Case retrieval using neural networksANNs perform very well in situations where some mechanism

of dynamic decision making and adaptive nature of applicationsis required. We have used neural networks for retrieving the casesin order to observe the efficiency (or deficiency) of neural networksexperientially.

While performing the case retrieval with CBR’s similarity met-rics, a set of random query cases was selected for retrieving similarcases out of all the cases in the case base (Details of populating thecases is given in previous Section 3.1). In order to carry out thesame task of case retrieval via ANN, ANN model was trained onall the cases in the case base and was tested on same set of querycases as above.

It was observed that the predictive performance to retrieve rel-evant cases attained using ANN shows better results than CBR caseretrieval as presented in Section 6.

3.3. Case adaptation of CBR

After similarity assessment of new case, we make a decisionabout case adaptation in order to reach an appropriate solutionprovided no similar problem (and respective solution) was foundin case base. The situation in which we have to go for adaptationis illustrated in the Fig. 10. We have a problem case of length ‘n’with some attributes (each case having 9 attributes each repre-sented with an ‘A’). After case retrieval, it is observed that their dif-fering attributes (A1 and A3) among retrieved cases impeding fromapplying the solution (A9 refers to solution). So we need to predictthe appropriate solution attribute (A9) based on adaptationtechnique.

Adaptation was performed in two ways (1) majority class votingand (2) using neural networks. These two techniques were com-pared to find their respective impact on predictive accuracy in pre-fetching. Following section briefly describes each of theapproaches:

3.3.1. Majority class voting (MCV) based adaptationThe concept of majority class voting is used to perform adapta-

tion while exploiting the frequency of solution attribute from re-trieved cases. In other words, we classify the retrieved cases withrespect to the last attribute of retrieved cases. We keep the trackof solution (9th attribute) for our problem case (first eight attri-butes) over the set of retrieved cases. On the basis of solution ele-ment, retrieved cases are classified. Then probability of each classis computed for retrieved cases. The class with highest probabilitywill be most probable solution for problem case. In other words,the class containing maximum number of cases (in terms of solu-tion attribute) is considered to be most appropriate solution forquery case and hence candidate for prefetching.

The approach is elucidated with the help of example given inFig. 11. There are three classes; devised by considering 9th attri-bute; 16 (with frequency 3), 10 (with frequency 2), 9 (with fre-quency 1) and 3 (with frequency 1). The most probable solutionwould be 16 according to MCV approach. Since there are threesolutions in the class with same value, tie is broken and one solu-tion is selected (problem attributes + solution attribute) arbitrarily.Either select any of these classes (as it is a common practice in ma-chine learning) or select on the basis of similarity level or the rank.In case all have the same rank; we have no option except selectingany of the cases from among all such choices.

3.3.2. Neural network based adaptationThe other task is to devise the computation model of neural net-

work for determining the predictive accuracy of ANN in case adap-tation. For the purpose of training and validation, we used thecases in case base. Back propagation neural network (namely

Page 8: A hybrid intelligent system to improve predictive accuracy for cache prefetching

Fig. 11. Case adaptation using MCV. Illustration of selecting most probable candidate out of available options.

Fig. 12. Configuration parameters for ANN.

Fig. 13. CBR vs. ANN in case retrieval.

S. Sarwar et al. / Expert Systems with Applications 39 (2012) 1626–1636 1633

MLP) with configurations in Fig. 12 was employed thoroughMatlab7.

These configuration parameters were set after number of exper-iments in order to optimize the results. Since the problem case haseight attributes, so the input layer has eight neurons and one out-put is modeled by one neuron. Rest of the parameters such as num-ber of hidden layers, number of neurons in each of these layers,learning function (or alpha) and number of epochs have beendecided through experimentation. Moreover, ‘‘ten-fold cross vali-dation’’ was performed in order to ensure that ANN do not over-fit and all the cases are properly covered.

3.3.3. Hybrid of CBR and ANN for adaptationThird approach is based on hybrid model of CBR and ANN with

respect to operation of predictive accuracy. In order to evaluate hy-brid of CBR and ANN, training of neural network was performed onretrieved cases only. These cases were retrieved using metrics de-scribed in Section 3.2. The query cases with exact solution (valida-tion set) were provided to test the predictive accuracy of ANNmodel (ANN had same parameters as given in Section 3.3.2).

4. Results

In this section, the results based on observations made duringthe retrieval and adaptation phases as mentioned in Sections 3.2and 3.3, respectively are presented. The comparison of above men-tioned techniques is presented followed by a comparative analysisof proposed technique with an existing one named ‘VANN (Vara-dan & Vaishnav, 2005)’. We used the same ANN model and param-eters as given in (Mowry et al., 1992) for the comparison purposes.

There were 1200 cases in our case base initially (method ofacquiring these cases is mentioned in Section 3.1). Random query

cases were given to retrieve the cases using our similarity metricdiscussed in Section 3.2 from the case base in the form of differentsets (each set carrying 100 cases) out of the case base of 1200 cases.In order to carry out the same task via ANN, ANN was trained onsame set of cases (1200 cases) and tested on same sets of querycases (we used eight sets). These query cases were given randomlyand were not present among 1200 cases (building CBR’s case baseas well as ANN’s training set).

We gave in query case (aka as problem case) and retrieve casesfrom CBR’s case base using similarity metrics ending up in percentsimilarity (Rank). We performed 120 epochs and got the predictiveaccuracy with associated cost in terms of mean square error. It wasobserved that the performance attained using ANN was better thancase retrieval via similarity metrics (represented by CBR in resultsof case retrieval) as affirmed by the results and is presented inFig. 13.

This is one aspect where we can find the performance compar-ison of CBR vs. ANN in terms of case retrieval. At the same time wehave to keep an eye on the associated cost in terms of mean squareerror.

As we can see in Fig. 14, the cost in terms of mean square errortends towards zero gradually and reducing cost is ideal with levelof prediction achieved using ANN.

Page 9: A hybrid intelligent system to improve predictive accuracy for cache prefetching

Fig. 14. Cost of ANN in case retrieval.

Fig. 15. ANN vs. CBR (MCV) vs. CBR + ANN in case adaptation.

Fig. 16. Cost of ANN in adaptation.

Fig. 17. Configuration parameters of VANN.

Fig. 18. Predictive Accuracy of CBR + ANN vs. VANN.

1634 S. Sarwar et al. / Expert Systems with Applications 39 (2012) 1626–1636

After retrieving the relevant cases and assessing their level ofsimilarity n dissimilarity, they were Reused or were subjected tothe phase of Adaptation. Firstly, the retrieved cases with similaritynot equal to 100% were adapted using majority class voting (MCV).We measured percent similarity to sort out most probable solutionusing MCV as explained in Section 3.3.1.

On the other hand, to evaluate the case adaptation by ANN and‘‘CBR + ANN’’, ANN model was trained on all the cases in case baseand on retrieved cases, respectively. Training set (retrieved cases)and validation sets contained 760 and 440 cases, respectively incase of adaptation by ANN only. For the purpose of validation, wegave right cases (correct problem and respective solution attri-butes) in validation set to test the predictive accuracy in findingthe solution.

Next task was to evaluate the hybrid of CBR and ANN. We gave8 sets of query cases (each carrying 100 cases) and for each set weretrieved cases from the case base containing same number of casesas above. We trained the ANN on the retrieved cases. The testingwas done using the query cases along with their correct solutionattributes.

It is important to mention that we extracted most frequentlyoccurring data patterns (FC = 10) unlike the previous cases (wherefrequency count was only four) in order to perform the adaptationusing ANN and perform experiment on best possible dataset (richin terms of patterns).

Again the cost does not tend to zero smoothly (as specified inFig. 16), rather at 28th epoch it starts tending down to zero. But

this reduction in cost is not unusual. The data carries much moremeaningful patterns so reduction can be expected at any point oftime.

Comparison of proposed hybrid was carried out with the tech-nique presented in Varadan and Vaishnav (2005) as well. We per-formed experiments using the following parameters as used inVaradan and Vaishnav (2005) as given in Fig. 17:

Here is the comparative analysis of our approach and the one gi-ven in Varadan and Vaishnav (2005) with respect to predictiveaccuracy.

It is not possible to fully ascertain the effectiveness of our ap-proach by predictive accuracy but associated cost must be cateredas well. In Fig. 19(a), we can see that the mean square error cost ofCBR + ANN decreases smoothly as compared to VANN (Varadan &Vaishnav, 2005) which not only fails in tending to zero but showsa spiky behavior Fig. 19(b).

Page 10: A hybrid intelligent system to improve predictive accuracy for cache prefetching

Fig. 19. Mean square error cost model of ‘‘CBR + ANN (a)’’ vs. ‘‘VANN (b)’’.

Table 1Comparison in terms of Precision and Recall.

Techniques Precision (%) Recall (%) F-measure (%)

CBR + ANN 78 90 83.5CBR (MCV) 59 78 67VANN 43 58 49

S. Sarwar et al. / Expert Systems with Applications 39 (2012) 1626–1636 1635

All these experiments are also represented in the form of per-cent ‘‘Precision and Recall’’. Standard precision and recall measuresare computed as follows:

Recall ¼ RelevantCases \ RetrievedCasesj jRelevantCasesj j ;

Precision ¼ RelevantCases \ RetrievedCasesj jRetrievedCasesj j ;

F-measure ¼ 2 � Precision � RecallPrecisionþ Recall

;

F-measure is a single measure that trades off Precision vs. Recall(Keith & Rijsbergen, 1986). We have taken average of results illus-trated in the Figs. 15 and 18 and computed average precision andrecall using above formulas. Handsome amount of precision isbeing achieved using our technique which further strengthenseffectiveness of proposed idea as shown in Table 1. Apart from pre-cision, recall also suggests that overall coverage of getting results isalso well comprehended.

5. Discussions

The results in terms of predictive accuracy and cost in terms ofmean square error cannot comprehend ours where we end up innot only improved accuracy but reduced error by a far distance.Rather this approach is hardly comparable to CBR (which weimplemented using MCV).

Why does our proposed approach work better than contempo-rary ones? The apparent reasons are presence of frequent patternsdue to employing suffix tries in preprocessing mode, retrieval ofmost relevant cases (in ‘CBR + ANN’) for training of ANN, selectionof case length (through experimentation) and learning function.Our statement can better be affirmed from results in Fig. 15 wherewe compare ANN, CBR (MCV), CBR + ANN, from Fig. 18 comparing

CBR + ANN with VANN (approach mentioned in Varadan andVaishnav (2005)) and from Table 1.

The results have revealed that proposed approach of‘‘CBR + ANN’’ has better predictive performance than fellow tech-niques. The differentiating aspect is usage of suffix tries in prepro-cessing mode, which provides rich and natural data patterns out ofavailable data. The presence of these patterns provides effectivelearning for neural networks and training on retrieved cases willfurther purify the training set and hence improves the productive-ness of proposed approach.

6. Conclusions

We have proposed and proved empirically that when CBR im-plied with ANN, the hybrid of these two approaches improvesthe predictive-ness for prefetching. Furthermore, ANN despitetheir compute intensive nature, have been found perfect in adapta-tion of cases retrieved using similarity metrics of CBR.

The developed architecture has the capability of overcoming thelatency of slow peripherals for saving CPU cycles and optimum re-source usage once implied for predictive prefetching. This pre-fetching is based on intelligent pattern manipulation specific tomemory addresses. The novelty of approach is signified to incorpo-ration of suffix tries for CBR’s case base population, usage of CBR toretain the current experience, benefit past knowledge and lastlymerger of Neural Networks for learning of system in extractingand recognizing knowledge patterns for case adaptation using CBR.

We look forward to evaluate the retrieval phase by devising dif-ferent similarity metrics to have more expressive options. Further-more, we will evaluate the proposed model by replacing the BPNNwith some other model such as RBF (radial basis function network)for further optimizing the solution (by minimizing the trainingset). Moreover, the cost to be incurred on not employing the spec-ified model will be computed to have an empirical cost comparisonfor real time systems.

Acknowledgements

The distinction and support provided by Sociedad Mexicana deInteligencia Artificial (SMIA) and the 9th Mexican InternationalConference on Artificial Intelligence (MICAI’2010) in order to en-hance, improve, and publish this work.

Page 11: A hybrid intelligent system to improve predictive accuracy for cache prefetching

1636 S. Sarwar et al. / Expert Systems with Applications 39 (2012) 1626–1636

The authors wish to acknowledge School of Electrical Engineer-ing and Computer Sciences, National University of Sciences andTechnology (NUST), Pakistan, for provision of various facilities inpreparation of this work.

Thanks to Dr. Shahid from University of Leads, United Kingdomwho has kindly reviewed our manuscript as native English speaker.His comments and suggestions helped us a lot and added to ourconfidence regarding quality of our write-up.

References

Aamodt, A., & Plaza, E. (1994). Case-based reasoning: Foundational issues,methodological variations, and system approaches. AI communications (vol. 7).IOS Press. Issue No. 1, pp. 39–59.

Ali, N., Krishna, M. R., & Sweany, P. (2007). Improving data cache performance withintegrate duse of Split cahe, victim cache and stream buffers. Workshop ontransactions on high-performance embedded architectures and compilers. LNCS(Vol. 3, pp. 279–297).

Arditi, D., & Tokdemir, B. (1999). Comparison of case-based reasoning and artificialneural networks. Journal of Computing in Civil Engineering, 10(3), 264–276.

Baer, D., & Chen, T. F. (1991). An effective on-chip preloading scheme to reduce dataaccess penalty. In ACM/IEEE conference on supercomputing (Vol. 120, pp. 176–186).

Batiels, G., Karlin, A., & Levy, H. (1999). Potentials and limitations of fault-basedMarkov prefetching for virtual memory pages. In ACM SIGMETRICS, internationalconference on measurement and modeling of computer systems (Vol. 6, pp. 206–207).

Chen, P., Mahlke, S. A., & Hwu, W. W. (1998). Data access micro-architectures forsuperscalar processors with compiler-assisted data prefetching. In 24thinternational symposium on micro architecture (Vol. 59, pp. 69–73).

Cherng, S. C., Dick, K., & Ladner, R. E. (2007). Algorithms to take advantage ofhardware prefetching. Proceedings of the ninth ALENEX (vol. 2, pp. 175–182).Philadelphia: SIAM.

Chtorou, S., Chtru, M., & Hammami, O. (2009). Performance evaluation of neuralnetwork prediction for data prefetching in embedded applications. InternationalJournal of Engineering and Applied Sciences, 2, 1–4.

Cunningham, P. (2009). A taxonomy of similarity mechanisms for case-basedreasoning. IEEE Transactions on Knowledge and Data Engineering, 21(8),1532–1543.

Finnie, G., & Sunt, Z. (2002). Similarity and metrics in case-based reasoning.International Journal of Intelligent Systems, 17(41), 273–287.

Hinton, G., Sager, D., Upton, M., Boggs, D., Carmean, D., & Kyker, A. (2004). Themicroarchitecture of the Pentium 4 Processor. In 30th Conference on VLDB (Vol.139, pp. 191–202).

Jouppi, N. P. (1989). Architectural and organizational tradeoffs in the design ofthe Multi-Titan CPU. In ACM SIGARCH computer architecture (Vol. 34,pp. 281–289).

Jouppi, B. P. (1990). Improving direct-mapped cache performance by the addition ofa small fully-associative cache and prefetch buffers. In International symposiumon computer architecture (Vol. 59, pp. 364–373).

Keith, C. J., & Rijsbergen, V. (1986). A new theoretical framework for informationretrieval. In Proceedings of the 9th annual international ACM SIGIR conference onresearch and development in information retrieval Palazzo, Pisa, Italy (Vol. 2, pp.194–200).

Linda, N., & Julia, L. (2003). The essentials of computer organization and architecture.Jones and Bartlett Publishers, Inc..

Mehrotra, L., & Harrison, L. (1995). Quantifying the performance potential of a dataprefetch mechanism for pointer-intensive and numeric programs. 1458, Technicalreport. Center for Supercomputing Research and Development, University ofIllinois.

Mowry, M., Lam, S., & Gupta, A. (1992). Design and evaluation of a compileralgorithm for prefetching. In International conference on architectural support forprogramming languages and operating systems (Vol. 441, pp. 62–73).

Papathanasiou, A. E., & Scott, M. L. (2005). Aggressive prefetching: An idea whosetime has come. In 10th Conference on hot topic in operating systems (Vol. 13, pp.1–6).

Reynolds, R. G., Michalewicz, Z., & Cavaretta, M. J. (1995). Using cultural algorithmsfor constraint handling in GENOCOP. Proceedings of the fourth annual conferenceon evolutionary programming (vol. 15, pp. 289–305). Cambridge: MIT Press.

Sankar, K., Simon, C., & Shiu, K. (2004). Foundations of soft case-based reasoning. JohnWiley and Sons, Inc..

Sarwar, S., Rasool, R., Mehmood, Y., Ahmed, H. F., & Takahashi, H. (2008). Usagedpattern based prefetching for mechanical mass storage. In 6th IEEE symposium ofhigh optical networks and enabling technology (pp. 7131–134).

Smith, R., & Thakar, S. (1997). Combining case based reasoning with neuralnetworks. AAAI, workshop on AI in service and support, Washington DC (Vol. 19,pp. 296–303).

Takahashi, H., Ahmad, H. F., & Mori, K. (2008). Layered memory architecture forhigh IO intensive information services to achieve timeliness. In Proceedings ofthe 11th IEEE high assurance systems engineering symposium (Vol. 5,pp. 343–349).

Ukkonen, E. (1992). Constructing suffix trees on-line in linear time. Proceedings ofIFIP 12th world computer congress on algorithms, software, architecture, Madrid,Spain (vol. 11, pp. 484–492). Elsevier Science Publishers.

Varadan, S. V., & Vaishnav, K. R. (2005). Application of neural networks in predictiveprefetching. In Proceedings of IEEE networking, sensing and control conference(Vol. 8, pp. 252–255).

Yain, S., & Babka, W. (1998). Neural network supported adaptation in case basedreasoning. AAAI Technical report. University of Macau, Faculty of Science andTechnology (Vol. 12, pp. 98–15).